#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=100;
typedef long long LL;
LL a[maxn];
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);
  LL t;cin>>t;
  while(t--){
    LL n;cin>>n;
    set<double>s;
    for(LL i=1;i<=n;i++) cin>>a[i];
    for(LL i=1;i<=n;i++){
        for(LL j=i+1;j<=n;j++){
            double area=(1.0*a[j]-1.0*a[i])*1.0*0.5;
            s.insert(area);
        }
    }
    cout<<s.size()<<endl;
  }
return 0;
}
